﻿using System.Web;

namespace Inscriptionem.Authorization
{
    public class Member
    {
        protected const string UserSessionToken = "Member";
        public static Member Current
        {
            get
            {
                var user = HttpContext.Current.Session[UserSessionToken] as Member;
                if (user == null)
                {
                    user = new Member();
                    HttpContext.Current.Session[UserSessionToken] = user;
                }
                return user;
            }
            set { HttpContext.Current.Session[UserSessionToken] = value; }
        }

        public Member()
        {
            ID = 0;

            FirstName = string.Empty;
            NickName = string.Empty;
            LastName = string.Empty;
            IsReadOnly = true;
            IsRealNameVisible = false;

            Role = MemberRole.None;
        }

        #region Properties
        public int ID { get; set; }

        public string FirstName { get; set; }
        public string NickName { get; set; }
        public string LastName { get; set; }
        public bool IsReadOnly { get; set; }
        public bool IsRealNameVisible { get; set; }

        public MemberRole Role { get; set; }
        #endregion
    }
}